#pragma once

#include "IXConfigFile.h"
#include "XBaseObjImpl.h"

class CXConfigFileImpl : public CXBaseObjImpl<IXConfigFile>
{
    typedef CXBaseObjImpl<IXConfigFile> superclass;
    DEF_SKIN_CLASS_SINGLE_INTF(CXConfigFileImpl,
        superclass,
        gs_strGuidXSkin,
        IXConfigFile,
        0);

public:
    CXConfigFileImpl();
    virtual ~CXConfigFileImpl();

public:
    // IXConfigFile
    virtual HRESULT STDMETHODCALLTYPE   put_FileXNC(IN LPCTSTR szFileXNC);
    virtual HRESULT STDMETHODCALLTYPE   put_Content(IN LPCSTR szContent, IN DWORD dwSize);
    virtual HRESULT STDMETHODCALLTYPE   GetNode(IN LPCTSTR szPath, OUT IXConfigNode** ppNode);
    virtual HRESULT STDMETHODCALLTYPE   GetRootNode(OUT IXConfigNode** ppNode);

public:
    virtual void    STDMETHODCALLTYPE   OnFinalRelease();

protected:
    void            ReleaseData();
    TiXmlElement*   GetElementByPath(LPCTSTR szPath);

protected:
    TiXmlDocument   m_Doc;
};

